//
// Created by Admin on 2023/5/21.
//

#include "ShoppingCart.h"

double
ShoppingCart::calculatePrice()
{
    Cashier* visitor{new Cashier()};
    for (int i{0}; i < items.size(); ++i) {
        items.at(i)->accept(visitor);
    }
    double total{visitor->getTotal()};
    return total;
}

void
ShoppingCart::add(Item* e)
{
    items.push_back(e);
}
